import time

from Page.Page import Page
from selenium.webdriver.common.by import By

class Page2(Page):
    # 我的酒仙
    myjiuxian = (By.XPATH,'/html/body/div[2]/div/div[2]/ul/li[1]/div[1]/a')
    # 弹窗
    web = (By.CLASS_NAME,'uGuideClose')
    # 我的地址
    addrees = (By.XPATH,'/html/body/div[4]/div[1]/div[2]/div[4]/a[3]/span')
    # 收货人
    people = (By.ID,'people')
    # 地区
    address1 = (By.ID,'province')
    # 地区
    address2 = (By.ID,'city')
    # 地区
    address3 = (By.ID,'district')
    # 详细地址
    addressxx= (By.ID,'address')
    # 编码
    zipcode = (By.ID,'zipcode')
    # 手机
    iphone = (By.ID,'iphone')
    # 固定电话
    phone = (By.ID,'phone')
    # 断言1
    dy1=(By.CLASS_NAME,'more')
    # 断言2
    dy2 = (By.XPATH,'/html/body/div[4]/div[3]/div[1]/h2')
    # 提交
    ti = (By.CLASS_NAME,'qjwSubmit2')
    def dy1_loc(self):
        return self.dy(self.dy1)
    def dy2_loc(self):
        return self.dy(self.dy2)
    # 封装方法
    def myjiuxian_loc(self):
        self.click(self.myjiuxian)
    def web_loc(self):
        self.click(self.web)
    def address_loc(self):
        self.click(self.addrees)
    def people_loc(self):
        self.send_keys(self.people,'mm')
    def address1_loc(self):
        self.select(self.address1,1)
    def address2_loc(self):
        self.select(self.address2,1)
    def address3_loc(self):
        self.select(self.address3,1)
    def addressxx_loc(self):
        self.send_keys(self.addressxx,'adfadf')
    def zipcode_loc(self):
        self.send_keys(self.zipcode,'100000')
    def iphone_loc(self):
        self.send_keys(self.iphone,'15232008902')
    def phone_loc(self):
        self.send_keys(self.phone,'15232008902')
    def ti_loc(self):
        self.click(self.ti)


    def address_lj(self):
        self.login_lj()
        self.myjiuxian_loc()
        time.sleep(2)
        self.window()
        time.sleep(2)
        self.web_loc()
        a = self.dy1_loc()
        print(a)
        assert a in '查看全部订单 >'
        self.stea(800)
        self.address_loc()
        b = self.dy2_loc()
        print(b)
        assert b in '收货地址'
        self.people_loc()
        self.address1_loc()
        self.address2_loc()
        self.address3_loc()
        self.addressxx_loc()
        self.zipcode_loc()
        self.iphone_loc()
        self.phone_loc()
        self.ti_loc()